package cn.iocoder.yudao.module.ems.dal.mysql.store;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ems.dal.dataobject.store.StoreDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ems.controller.admin.store.vo.*;

/**
 * 仓库 Mapper
 *
 * @author 左Dason
 */
@Mapper
public interface StoreMapper extends BaseMapperX<StoreDO> {

    default PageResult<StoreDO> selectPage(StorePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StoreDO>()
                .likeIfPresent(StoreDO::getName, reqVO.getName())
                .eqIfPresent(StoreDO::getStatus, reqVO.getStatus())
                .orderByDesc(StoreDO::getId));
    }

    default List<StoreDO> selectList(StoreListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StoreDO>()
                .likeIfPresent(StoreDO::getName, reqVO.getName())
                .eqIfPresent(StoreDO::getStatus, reqVO.getStatus())
                .orderByDesc(StoreDO::getId));
    }

}
